import { useAuthStore } from '@/store';

const userStore = useAuthStore();

export function addFamily(family: any) {
    const obj = userStore.nurseUser.nurseUserFamilyList.find((item: any) => item.relation == '1');
    if (obj) {
        obj.name = userStore.nurseUser.name;
        obj.phone = userStore.nurseUser.phone;
        obj.idcard = userStore.nurseUser.idcard;
    }
    else {
        userStore.nurseUser.nurseUserFamilyList.push({
            name: userStore.nurseUser.name,
            sex: "1",
            idcard: userStore.nurseUser.idcard,
            phone: userStore.nurseUser.phone,
            area: "",
            areaName: "",
            address: "",
            isSelf: "",
            age: "",
            ageUnit: "岁",
            relation: "",
            relationName: "",
            record: "",
            hospital: "",
            hospitalName: "",
            dept: "",
            deptName: "",
            bed: "",
            bedName: "",
            status: "1",
            id: "",
            userId: userStore.nurseUser.id
        });
    }
}